package cn.t.keycloak.plugin.login.jpa;

import org.keycloak.Config;
import org.keycloak.connections.jpa.entityprovider.JpaEntityProvider;
import org.keycloak.connections.jpa.entityprovider.JpaEntityProviderFactory;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author 陶敏麒
 * @date 2023/11/22 15:00
 */
public class VerifyPhoneJpaEntityProviderFactory implements JpaEntityProviderFactory {

    private static final Logger log = LoggerFactory.getLogger(VerifyPhoneJpaEntityProviderFactory.class);
    public static final String PROVIDER_ID = "verify-phone-entity-provider";
    @Override
    public JpaEntityProvider create(KeycloakSession keycloakSession) {
        return new VerifyPhoneJpaEntityProvider();
    }

    @Override
    public void init(Config.Scope scope) {
        log.info(">>>>开始加载自定义的数据对象工厂VerifyPhoneJpaEntityProviderFactory");
    }

    @Override
    public void postInit(KeycloakSessionFactory keycloakSessionFactory) {}

    @Override
    public void close() {}

    @Override
    public String getId() {
        return PROVIDER_ID;
    }
}
